home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Library
/
RoseWare - Network Support Library.iso
/
apidev
/
mhs_c.arc
/
INPOST.ARC
/
OUTFILE.C
< prev
next >
Wrap
C/C++ Source or Header
|
1988-06-27
|
3KB
|
123 lines
/* ******************************* OUTFILE.C ****************************** */
#include "cctypes.h"
extern int OutFile;
extern char OutExtension[];
extern int ErrorsInThisFile;
extern int WarningsInThisFile;
extern char InFileName[];
extern char OutFileName[];
extern long fileSize;
extern char messageBuffer[];
extern MCB MCBStruct;
int SetUpOutFile()
{
int ccode;
/* open the output file */
ccode = OpenOutputFile(OutExtension);
if ( ccode)
return(CANNOT_CREATE_OUTPUT);
return(0);
}
void BlankLine()
{
write(OutFile, "\15\12", 2); /* CR-LF */
}
void WriteMCBFile()
{
char temp[5];
/* setup the (MCB) output */
if ( SetUpOutFile() ) {
Error(CANNOT_CREATE_OUTPUT);
return;
}
/* 1 */
write(OutFile, MCBStruct.MHSVersion, strlen(MCBStruct.MHSVersion));
BlankLine();
/* 2 */
sprintf(temp, "%d", MCBStruct.headerLines);
write(OutFile, temp, strlen(temp));
BlankLine();
/* 3 */
sprintf(temp, "%d", MCBStruct.MCBType);
write(OutFile, temp, strlen(temp));
BlankLine();
/* 4 */
/* write(OutFile, MCBStruct.deliveryOptions, 1); */
BlankLine();
/* 5 */
write(OutFile, MCBStruct.originatingApplicationName,
strlen(MCBStruct.originatingApplicationName));
BlankLine();
/* 6 */
write(OutFile, MCBStruct.originatingUsername,
strlen(MCBStruct.originatingUsername));
BlankLine();
/* 7 */
write(OutFile, MCBStruct.originatingHost,
strlen(MCBStruct.originatingHost));
BlankLine();
/* 8 */
write(OutFile, MCBStruct.destinationUsername,
strlen(MCBStruct.destinationUsername));
BlankLine();
/* 9 */
write(OutFile, MCBStruct.destinationHost,
strlen(MCBStruct.destinationHost));
BlankLine();
/* 10 */
write(OutFile, MCBStruct.messageSubject,
strlen(MCBStruct.messageSubject));
BlankLine();
/* 11 */
write(OutFile, MCBStruct.attachmentFilename,
strlen(MCBStruct.attachmentFilename));
BlankLine();
/* 12 */
/* blank line for sealed message ID*/
BlankLine();
/* 13 */
/* blank line for referenced message ID */
BlankLine();
/* 14 */
/* blank line for date sealed */
BlankLine();
/* 15 */
/* blank line for date unsealed */
BlankLine();
/* 16 */
sprintf(temp, "%d", MCBStruct.contentTypeOfAttachmentFile);
write(OutFile, temp, strlen(temp));
BlankLine();
/* 17 */
/* blank line for status report */
BlankLine();
/* 18 */
/* last line in MCB */
BlankLine();
if ( strlen(messageBuffer) )
write(OutFile, messageBuffer, strlen(messageBuffer));
fileSize = lseek(OutFile,(long)0,2);
close(OutFile);
if ( ErrorsInThisFile ) {
/* unlink(OutFileName); */
ErrorsInThisFile = 0;
}
return;
}